
package com.study.model.jdao;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.springframework.data.repository.CrudRepository;

import com.study.model.pojo.Customer;
import com.study.model.pojo.Dictionary;
import com.study.model.pojo.User;

public interface ICustomerDAO extends CrudRepository<Customer, Integer> {
	

	/**
	 * 查询对应客户id的信息
	 * @param cusshow
	 * @return
	 */
	public Customer findByCusId(int cusid);

	/**
	 * 查询所有可见用户
	 * 
	 * @param cusshow
	 * @return
	 */
	public List<Customer> findByCusShow(int cusshow);

	/**
	 * 查询可见的自己的客户
	 * 
	 * @param cusshow
	 * @param user
	 * @return
	 */

	
	
	public List<Customer> findByCusShowAndUser(int cus,User user);
     /*List<Customer> findByCusNameOrderByCusId();*/
	
	
	/**
	 * 根据种类查询客户
	 * 
	 * @param cusshow
	 * @param user
	 * @param custype
	 * @return
	 */
	public List<Customer> findByCusShowAndUserAndDictionary6(int cusshow, User user, Dictionary custype);

	/**
	 * 根据信用等级查询
	 * 
	 * @param cusshow
	 * @param user
	 * @param cuscredit
	 * @return
	 */
	public List<Customer> findByCusShowAndUserAndDictionary3(int cusshow, User user, Dictionary cuscredit);

	/**
	 * 根据客户状态查询可见客户（潜在，签约....）
	 * 
	 * @param cusshow
	 * @param user
	 * @param ccusstatus
	 * @return
	 */
	public List<Customer> findByCusShowAndUserAndDictionary5(int cusshow, User user, Dictionary ccusstatus);
	
	/**
	 * 通过名字找到客户
	 * @param name
	 * @return
	 */
	public Customer findByCusName(String name);


	/**
	 * 查询客户状态为不失效的客户
	 * @param type
	 * @return
	 */
	List<Customer> findByDictionary6(Dictionary dictionary6);
	
	/**
	 * 修改状态客户
	 */
	public Customer save(Customer cust);
	
	
	Iterable<Customer> findAll();
		
}

